home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1991 / Feb 91 / MacApp.Tech$ 2⁄1⁄91 / 2833-bug in SetClikLoop-Jan91 < prev    next >
Encoding:
Text File  |  1991-03-06  |  2.6 KB  |  72 lines  |  [TEXT/GEOL]

  1. Item    8206312                         31-Jan-91        21:40PST
  2.  
  3. From:   MUYSVASOVIC                     ACE - Jean-Denis Muys-Vasovic
  4.  
  5. To:     MACDTS                          Macintosh Developer Tech Supt
  6.         MACAPP.TEST                     MacApp SQA Team
  7.         APPLE.BUGS                      Apple Bugs Reporting
  8.         DEV.TECH.PUB                    Developer Technical Pub
  9.  
  10. cc:     MACAPP.TECH$                    MacApp Technical
  11.  
  12. Item forwarded by       FRED.FORSMAN to HALPIN1 
  13.  
  14. ------------------------------------------------------------------------------
  15.  
  16. Sub:    bug in SetClikLoop
  17.  
  18. Dear fellows,
  19.  
  20. How happy we are: there is a bug in MacApp (2.0.1) which shows up only
  21. sometimes, and only in Debug mode. In fact the bug is in MacApp because it is
  22. in Inside Macintosh.
  23.  
  24. Symptom: sometimes in debug mode, in a TTEView, you can't select the text by
  25. dragging. Sometimes a you can for a while, and suddenly when you drag, the
  26. selection stops to expand.
  27.  
  28. Explanation: In TTEView.DoMouseCommand, There is a call to TEClick which
  29. returns even though the mouse button is still down. Why? Because MacApp
  30. installs a clickloop routine with SetClikLoop. IM describes the clickloop
  31. procedure as being:
  32.  
  33. FUNCTION clikProc: BOOLEAN;                             or in C:
  34. typedef pascal Boolean (*ClikLoopProcPtr)(void);
  35.  
  36. AND THIS IS WRONG. I traced in the ROM of several Macintoshes, and TEClick does
  37. JSR (A0) and BEQ.S exit. So the result should not be on the stack, as for any
  38. pascal Boolean function, but in the Z flag. At least if the function was
  39. declared as C, then the result would be in D0, with a slightly better chance
  40. for the Z flag to be OK.
  41.  
  42. Why are we lucky? because the current MacApp implementation, which wrongly
  43. follows IM, generates code which happens to set the Z flag correctly.
  44. Unfortunately, in -Trace mode, there is a call to %_EP which sometimes trashes
  45. the Z flag.
  46.  
  47. Fixes:
  48. 1- add the -NoTrace option to MABuild
  49. 2- in TTEView.IRes and TTEView.ITEView, comment out the line:
  50.           SetClikLoop(@ClickLoopForTTEView, fHTE);
  51. 3- this is not really a fix, but should work. Bracket the ClickLoopForTTEView
  52. function definition between directives to turn trace mode off:
  53.  
  54. {$PUSH}{$IFC qNames}{$D+}{$ELSEC}{$D-}{$ENDC}
  55.  
  56. FUNCTION ClickLoopForTTEView: BOOLEAN;
  57.             [ ... ]
  58.  
  59. {$POP}
  60. 4- You can additionally redeclare ClickLoopForTTEView as a C function, but this
  61. not a fix either.
  62. 5- The real fix is to rewrite ClickLoopForTTEView in assembly to make sure it
  63. sets the Z flag correctly. I won't show it because it's easy to do, but ask for
  64. it if you need it.
  65.  
  66. Now all of this might be very old stuff, in which case I apologize.
  67.  
  68. Regards,
  69.  
  70. Jean-Denis
  71.  
  72.